Skip to content

feat: support severity-based diagnostic filtering (#776) - #1930

Open
CG-5228 wants to merge 1 commit into
rokucommunity:v1from
CG-5228:oss-agent/issue-776
Open

CG-5228 wants to merge 1 commit into
rokucommunity:v1from
CG-5228:oss-agent/issue-776

Conversation

@CG-5228

@CG-5228 CG-5228 commented Oct 16, 2026 •

Copy link
Copy Markdown

Summary

Fixes #776

Root Cause: DiagnosticFilterer only supported filtering diagnostics by numeric or string diagnostic codes (codes) and file globs (files in v1, src in v0 compatibility mode), lacking support for filtering diagnostics by severity (error, warn/warning, info/information, hint). Additionally, if a filter object specified an empty or all-invalid severities array (e.g., { "files": "vendor/**/*", "severities": [] }), normalizing empty arrays to undefined could cause the filter to be treated as a file-only filter and accidentally suppress all diagnostics in matching files.

Fix: Added BsDiagnosticSeverity type and severities/severity properties to BsConfig.diagnosticFilters (src/BsConfig.ts and bsconfig.schema.json), implemented severity normalization and filtering in src/DiagnosticFilterer.ts and src/DiagnosticManager.ts (supporting global, files/src/dest-scoped, negative-glob, and combined codes + severities logical-AND filters while preserving empty severities: [] arrays so they match zero diagnostics rather than collapsing to file-wide suppression), documented severity filtering in docs/bsconfig.md, and added comprehensive unit tests in src/DiagnosticFilterer.spec.ts.

Files Modified

  • bsconfig.schema.json
  • docs/bsconfig.md
  • src/BsConfig.ts
  • src/DiagnosticFilterer.spec.ts
  • src/DiagnosticFilterer.ts
  • src/DiagnosticManager.ts

Verification Performed (Isolated Container Sandbox)

  • Base Upstream Commit SHA: 79f2aa6796c18922c4f7a33da294a538a04ed43e
  • Container Image: node:22-bookworm (--network none --read-only --cap-drop ALL)
  • Test Command: npm run test:nocover && npm run lint && npm run build
  • Baseline Test Run: 5351 passed, 9 pending, 0 failed (exit 0)
  • Post-Fix Test Run: 5365 passed, 9 pending, 0 failed (exit 0)
  • Linter / Typecheck Passed: Yes
  • Build Passed: Yes
  • Secret & Unrelated Diff Scan: Clean (0 secrets, 0 unrelated files)

Acceptance Criteria Verification

  • Support severity-based diagnostic filtering (error, warn/warning, info/information, hint) globally and per file glob (files and v0 src) — verified (Verified by unit tests in src/DiagnosticFilterer.spec.ts)
  • Ensure empty or invalid severity arrays (severities: []) do not accidentally suppress all diagnostics in matching files or mark files as completely filtered — verified (Verified by 4 dedicated unit tests in src/DiagnosticFilterer.spec.ts (empty severity arrays, invalid severity names, empty severities combined with codes, negative filters with empty severities))
  • Pass full v1 repository test suite, linter, and build — verified (5,365 passing, 9 pending, 0 failing (npm run test:nocover), npm run lint passed, npm run build passed)

@markwpearce

Copy link
Copy Markdown
Collaborator

Change this to work on the v1 branch

@CG-5228
CG-5228 force-pushed the oss-agent/issue-776 branch 2 times, most recently from 434bd63 to 78246b6 Compare October 18, 2026 03:06
@CG-5228
CG-5228 changed the base branch from master to v1 October 18, 2026 03:06
@CG-5228
CG-5228 force-pushed the oss-agent/issue-776 branch from 78246b6 to de8e9e3 Compare October 20, 2026 00:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for diagnosticFilters to ignore by severity instead of specific code

2 participants